import type { PropType } from 'vue'
import type { ExtractProps } from '@/utils/type'
import { useNamespace } from '@/utils'

export namespace variables {
  export const ns = useNamespace('Button')
  export const type = ['primary', 'info', 'danger', 'warning', 'success'] as const
}
export namespace ButtonNS {
  export const name = variables.ns.name
  export const props = {
    disabled: Boolean,
    loading: Boolean,
    type: {
      type: String as PropType<typeof variables.type[number]>,
      default: variables.type[0]
    },
    icon: String
  }
  export const emits = {
    click: (_e: MouseEvent) => true
  }
  export type Props = ExtractProps.Types<typeof props> & PartialEmits<typeof emits>
  export type Slots = {
    default: () => void,
    loading: () => void
  }
  export const Component = <{
    new(): {
      $props: Props
      $slots: Slots
    }
  }>{}
}